package com.example.myapplication;

import android.content.Intent;
import android.os.Bundle;


import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;


public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        CoordinatorLayout a = findViewById(R.id.a);


        AlphaAnimation alphaAnimation = new AlphaAnimation(0f,1f);
        alphaAnimation.setDuration(3000);
        alphaAnimation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {}

        @Override
        public void onAnimationEnd(Animation animation) {
            jumpToMain();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {}
    });
        a.startAnimation(alphaAnimation);
}

    private void jumpToMain() {
        Intent intent =
                new Intent(SplashActivity.this, MainActivity.class );
        startActivity(intent);
        finish();


    }

}
